package com.lyy.polymorphic.polyarr;


/**
 * @Author:  GZQ
 * @date:  2024/11/19 23:15
 * @description: 多态数组里面的 子类 -- 老师类
 */

public class Teacher extends Person {

    private int salary;

    public Teacher(String name, int age, int salary) {
        super(name, age);
        this.salary = salary;
    }

    public int getSalary() {
        return salary;
    }

    public void setSalary(int salary) {
        this.salary = salary;
    }

    // 重写父类的 say方法
    @Override
    public String say() {
        return "老师 " + super.say() + " salary=" + salary;
    }
    // 特有的方法
    public void teach() {
        System.out.println("老师 " + getName() + " 老师正在讲课");
    }
}
